package cn.jhc.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.jhc.bean.UserBean;
import cn.jhc.dao.ShopDAO;
@WebServlet("/deletelist.do")
public class DeleteListServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	HttpSession session=req.getSession();
	req.setCharacterEncoding("UTF-8");
	UserBean users = (UserBean) session.getAttribute("user");
	String date=req.getParameter("date");
	String time=req.getParameter("time");
	String datetime=date+" "+time;
	ShopDAO dao=null;
	if (null != users) {
		dao=new ShopDAO();
		String user=users.getDisplayname();
		try{
		dao.deletelist(user,datetime);
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}RequestDispatcher dispatcher = req.getRequestDispatcher("/checklist.do");
	dispatcher.forward(req, resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	doPost(req, resp);
}
}
